import { Column, Entity, ManyToMany, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { User } from "@/modules/user/entities/user.entity";
import { EntityBase } from "@/common/entities/entity.base";
import { ApiProperty } from "@nestjs/swagger";
import { UserRole } from "@/modules/user-role/entities/user-role.entity";


@Entity()
export class Role extends EntityBase {
	@ApiProperty({ description: "id" })
	@PrimaryGeneratedColumn({ type: "bigint" })
	id: string;
	
	@ApiProperty({ description: "角色名称" })
	@Column({ type: "varchar", length: 100, comment: "角色名称" })
	name: string;
	
	@ApiProperty({ description: "角色备注" })
	@Column({ type: "varchar", length: 100, default: "", comment: "角色备注" })
	remark: string;
	
	// @ManyToMany(() => User, (user) => user.roles)
	// users: User[];
	@OneToMany(() => UserRole, (userRole) => userRole.role)
	userRole: UserRole[];
	// @ManyToMany(() => Menus, (menus) => menus.role)
	// @Expose()
	// menus: Menus[];
}
